package gmail.pyanoveugen.studyproject.service;

import gmail.pyanoveugen.studyproject.bean.UserBean;
import gmail.pyanoveugen.studyproject.dao.DaoFactory;
import gmail.pyanoveugen.studyproject.dao.UserDao;

import java.util.List;

public class AuthService {

    UserDao userDao = DaoFactory.getInstance().getUserDao();

    public boolean authorize(String login, String password) {

        UserBean user = new UserBean();
        user.setLogin(login);
        user.setPassword(password);

        List<UserBean> users = userDao.find(user);

        if (users != null && users.size() == 1)
            return true;
        else
            return false;
    }

}
